package com.fs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.fs.domain.AgencyCertificationAudit;
import com.fs.service.IAgencyCertificationAuditService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 企业认证管理Controller
 * 
 * @author csq
 * @date 2024-10-17
 */
@RestController
@RequestMapping("/certificate/certificate")
public class AgencyCertificationAuditController extends BaseController
{
    @Autowired
    private IAgencyCertificationAuditService agencyCertificationAuditService;

    /**
     * 查询企业认证管理列表
     */
    @PreAuthorize("@ss.hasPermi('certificate:certificate:list')")
    @GetMapping("/list")
    public TableDataInfo list(AgencyCertificationAudit agencyCertificationAudit)
    {
        startPage();
        List<AgencyCertificationAudit> list = agencyCertificationAuditService.selectAgencyCertificationAuditList(agencyCertificationAudit);
        return getDataTable(list);
    }

    /**
     * 导出企业认证管理列表
     */
    @PreAuthorize("@ss.hasPermi('certificate:certificate:export')")
    @Log(title = "企业认证管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AgencyCertificationAudit agencyCertificationAudit)
    {
        List<AgencyCertificationAudit> list = agencyCertificationAuditService.selectAgencyCertificationAuditList(agencyCertificationAudit);
        ExcelUtil<AgencyCertificationAudit> util = new ExcelUtil<AgencyCertificationAudit>(AgencyCertificationAudit.class);
        util.exportExcel(response, list, "企业认证管理数据");
    }

    /**
     * 获取企业认证管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('certificate:certificate:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(agencyCertificationAuditService.selectAgencyCertificationAuditById(id));
    }

    /**
     * 新增企业认证管理
     */
    @PreAuthorize("@ss.hasPermi('certificate:certificate:add')")
    @Log(title = "企业认证管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AgencyCertificationAudit agencyCertificationAudit)
    {
        return toAjax(agencyCertificationAuditService.insertAgencyCertificationAudit(agencyCertificationAudit));
    }

    /**
     * 修改企业认证管理
     */
    @PreAuthorize("@ss.hasPermi('certificate:certificate:edit')")
    @Log(title = "企业认证管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AgencyCertificationAudit agencyCertificationAudit)
    {
        return toAjax(agencyCertificationAuditService.updateAgencyCertificationAudit(agencyCertificationAudit));
    }

    /**
     * 删除企业认证管理
     */
    @PreAuthorize("@ss.hasPermi('certificate:certificate:remove')")
    @Log(title = "企业认证管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(agencyCertificationAuditService.deleteAgencyCertificationAuditByIds(ids));
    }

//    /**
//     * 驳回企业认证管理
//     */
//    @PreAuthorize("@ss.hasPermi('certificate:certificate:reject')")
//    @Log(title = "企业认证管理", businessType = BusinessType.REJECT)
//    @PutMapping
//    public AjaxResult reject(@RequestBody AgencyCertificationAudit agencyCertificationAudit)
//    {
//        return toAjax(agencyCertificationAuditService.updateAgencyCertificationAudit(agencyCertificationAudit));
//    }
//
//    /**
//     * 通过企业认证管理
//     */
//    @PreAuthorize("@ss.hasPermi('certificate:certificate:pass')")
//    @Log(title = "企业认证管理", businessType = BusinessType.PASS)
//    @PutMapping
//    public AjaxResult pass(@RequestBody AgencyCertificationAudit agencyCertificationAudit)
//    {
//        return toAjax(agencyCertificationAuditService.updateAgencyCertificationAudit(agencyCertificationAudit));
//    }
}
